package thingapi

import (
	"fmt"
	"iot-base/common/eventtype"
	"iot-base/common/logger"
	"iot-base/common/notify"
)

func initEventListenner() {
	notify.SubMsg(false, "event", &eventtype.Event{}, func(t string, body interface{}) {
		fmt.Println("alarm changed -------------------------!!!!!!!!!!!", body)
		pEvent, ok := body.(*eventtype.Event)
		if ok {
			server.BroadcastToRoom("", "alarmRoom", "event", pEvent)
		} else {
			logger.SLog.Error("event error", body)
		}

	})
}
